5ceea0b547160816648f30c7540e7ef2e7512a95,src/main/java/com/continuuity/metadata/MetadataService.java,MetadataService,createQuery,#Account#Query#,683
Before Change
// loop a few times for write conflict resolution
for (int attempts = 3; attempts > 0; --attempts) {
// there is already an entry, determine how it compare to the new one
CompareStatus status = compare(query, readEntry);
// existing entry is equal or a superset of the new one -> good
if (status.equals(CompareStatus.EQUAL) ||
status.equals(CompareStatus.SUB))
return true;
else if (status.equals(CompareStatus.DIFF)) {
// new entry is incompatible with existing -> conflict!
throw new MetadataServiceException("another, incompatible meta " +
"data entry already exists.");
}
// Create a new metadata entry for update
MetaDataEntry entry = makeEntry(account, query);
try {
// Invoke MDS to update entry, this can again fail with write conflict
mds.update(context, entry);
return true;
} catch (OperationException e) {
After Change
// loop a few times for write conflict resolution
for (int attempts = 3; attempts > 0; --attempts) {
// there is already an entry, determine how it compare to the new one
CompareStatus status = readEntry == null
? CompareStatus.SUPER : compare(query, readEntry);
// existing entry is equal or a superset of the new one -> good
if (status.equals(CompareStatus.EQUAL) ||
status.equals(CompareStatus.SUB))
return true;
else if (status.equals(CompareStatus.DIFF)) {
// new entry is incompatible with existing -> conflict!
throw new MetadataServiceException("another, incompatible meta " +
"data entry already exists.");
}
// Create a new metadata entry for update
MetaDataEntry entry = makeEntry(account, query);
try {
// Invoke MDS to update entry, this can again fail with write conflict
if (readEntry == null) {
mds.add(context, entry);
} else {
mds.update(context, entry);
}
return true;